package com.cloudcross.ssp.service;



import java.util.List;
import java.util.Map;

import com.cloudcross.ssp.model.AdvBalance;
import com.cloudcross.ssp.base.service.IGenericService;
import com.cloudcross.ssp.common.utils.Pager;

/**
 * 用户服务接口定义。
 * 
 * @author
 */
public interface IAdvBalanceService extends IGenericService<AdvBalance> {
	/**
	 * 根据代理商id查找它的当前余额
	 */
	Double findBalanceByAgentId(Long agentId);
	
	/**
	 * 根据广告主id得到广告主的余额
	 * @param advertiserId
	 * @return
	 */
	Double findBalanceByAdvertiserId(Long advertiserId);
	
	/**
	 * 根据代理商id更新它的当前余额
	 * @param balance
	 * @return
	 */
	boolean updateBalanceByAgentId(Long agentId, Double balance);
	
	/**
	 * 删掉当前的广告主充值记录
	 * @param id
	 * @return
	 */
	boolean deleteAdvBalanceById(Long id);
	
	List<AdvBalance> findByParams(Map<String, Object>paramMap);
	 AdvBalance findAdvertiserName(String advertiserName);
	 int countByParams(Map<String, Object> paramMap);
	 int countByParams2(Map<String, Object> paramMap);
	 List<AdvBalance> findByParams(Map<String, Object> paramMap, Pager pager);
	 List<AdvBalance> findByParams2(Map<String, Object> paramMap);
	 List<AdvBalance> findByParams2(Map<String, Object> paramMap, Pager pager);
	 int countByParamsBack(Map<String, Object> paramMap);
	 List<AdvBalance> findByParamsBack(Map<String, Object> paramMap, Pager pager);
	 
	 List<AdvBalance> findByParamsAdvertiser(Map<String, Object> paramMap);
	 
	/**
	 * 撤销充值
	 * 
	 * @param paramMap
	 * @return
	 */
	boolean backOut(Map<String, Object> paramMap);
	 

}